/**   
 * @Title: BeidanNoFilterAgainstInfoCommunicater.java 
 * @Package com.esun.rabbit2.communicaters.beijingdanchang
 * @Description: 无筛选对阵信息列表获取
 * @author: Kael gaojian@500wan.com   
 * @date: 2012-4-9 下午16:39:00  
 * Copyright: (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.rabbit2.communicaters.beijingdanchang;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.http.client.ClientProtocolException;
import org.xml.sax.SAXException;
import com.esun.config.BussinessCode;
import com.esun.config.Key;
import com.esun.model.beijingdanchang.BeidanAgainstInfo;
import com.esun.network.ServerCommunicater;
import com.esun.util.HashMapUtil;

/**
 * @ClassName: BeidanNoFilterAgainstInfoCommunicater
 * @Description: 无筛选对阵信息列表获取
 * @author: Kael gaojian@500wan.com
 * @date: 2012-4-9 下午16:39:00
 * 
 */
public class BeidanNoFilterAgainstInfoCommunicater extends ServerCommunicater {
	private boolean isSucceed = false;

	public boolean isGetInfoSucceed() throws ClientProtocolException, IOException, ParserConfigurationException, SAXException {

		ArrayList<HashMap<String, String>> arraylist = new ArrayList<HashMap<String, String>>();
		arraylist.add(HashMapUtil.getMapItem(BussinessCode.PASER_MID, BussinessCode.MID_BEIDAN_AGAINSTINFO));// 接口号
		super.getServerResponse(arraylist, true);
		if (super.getState() == 100) {
			isSucceed = true;
		} else {
			isSucceed = false;
		}
		return isSucceed;
	}

	public ArrayList<BeidanAgainstInfo> getAgainstInfoList() {

		ArrayList<BeidanAgainstInfo> listBeiDanAgainstInfos = new ArrayList<BeidanAgainstInfo>();
		ArrayList<Hashtable<String, String>> list = new ArrayList<Hashtable<String, String>>();
		list = super.getListResult();
		if (list != null) {
			int count = list.size();
			for (int i = 0; i < count; i++) {
				Hashtable<String, String> hashtable = new Hashtable<String, String>();
				hashtable = list.get(i);
				BeidanAgainstInfo beiDanAgainstInfo = new BeidanAgainstInfo();
				beiDanAgainstInfo.setExpect(super.getResult().get(Key.KEY_EXPECT));// 期号
				beiDanAgainstInfo.setMatchDate(hashtable.get(Key.KEY_MATCHDATE));// 比赛归属日
				beiDanAgainstInfo.setMatchWeek(hashtable.get(Key.KEY_MATCHWEEK));// 星期
				beiDanAgainstInfo.setSchedulesDate(hashtable.get(Key.KEY_SCHEDULESDATE));
				beiDanAgainstInfo.setId(hashtable.get(Key.KEY_ID));
				beiDanAgainstInfo.setOrderNum(hashtable.get(Key.KEY_ORDERNUM));// 序号
				beiDanAgainstInfo.setSimpleLeague(hashtable.get(Key.KEY_LEAGUEMATCHNAME));// 联赛名
				beiDanAgainstInfo.setHomeSxName(hashtable.get(Key.KEY_HOMESXNAME));// 主队
				beiDanAgainstInfo.setGuestSxName(hashtable.get(Key.KEY_GUESTSXNAME));// 客队
				beiDanAgainstInfo.setEndTime(hashtable.get(Key.KEY_ENDTIME));// 截止时间
				beiDanAgainstInfo.setxId(hashtable.get(Key.KEY_XID));
				beiDanAgainstInfo.setProcessName(hashtable.get(Key.KEY_PROCESSNAME));
				beiDanAgainstInfo.setRangqiu(hashtable.get(Key.KEY_RANGQIU));// 让球
				beiDanAgainstInfo.setC1(hashtable.get(Key.KEY_C1));
				beiDanAgainstInfo.setC3(hashtable.get(Key.KEY_C3));
				beiDanAgainstInfo.setC5(hashtable.get(Key.KEY_C5));
				listBeiDanAgainstInfos.add(beiDanAgainstInfo);
			}
		}

		return listBeiDanAgainstInfos;
	}
}
